package code08_三大特征;

/*
 * 学生管理系统
 */
public class Test04_继承 {
	public static void main(String[] args) {
		Pupil s1 = new Pupil("tom", 8, "男", "花园宝宝");
		s1.show();
		s1.watch();
		
		College stu2 = new College("刘庆皇", 22, "男", "卢宇");
		stu2.show();
		stu2.love();
	}
}

/*
 * 学生类，父类
 */
class Student{
	String name;
	int age;
	String sex;
	
	public void show() {
		System.out.println("我是一个学生，姓名：" + name + "，年龄：" + age + "，性别：" + sex);
	}
}

/*
 * 小学生类，子类
 */
class Pupil extends Student{
	// 特有属性
	String cartoon; // 动画片

	public Pupil() {
		super();
	}

	public Pupil(String name, int age, String sex, String cartoon) {
		super();
		this.name = name;
		this.age = age;
		this.sex = sex;
		this.cartoon = cartoon;
	}

	// 特有行为
	public void watch() {
		System.out.println("正在看动画片。。。。" + cartoon);
	}
}

/*
 * 中学生类
 */
class Middle extends Student {
	String game;

	public Middle() {
		super();
	}

	public Middle(String name, int age, String sex, String game) {
		super();
		this.name = name;
		this.age = age;
		this.sex = sex;
		this.game = game;
	}

	public void play() {
		System.out.println("正在打游戏。。。。。" + game);
	}
}

/*
 * 大学生类
 */
class College extends Student {
	String lover; // 对象

	public College() {
		super();
	}

	public College(String name, int age, String sex, String lover) {
		super();
		this.name = name;
		this.age = age;
		this.sex = sex;
		this.lover = lover;
	}

	public void love()
	{
		System.out.println("正在谈恋爱。。。。" + lover);
	}

}
